package com.wy.service.impl.wy;

import com.wy.dao.ResidenceMapper;
import com.wy.model.sys.Residence;
import com.wy.service.wy.ResidenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service("residenceServiceImpl")
public class ResidenceServiceImpl implements ResidenceService {

	@Autowired
	private ResidenceMapper residenceDao;

	@Override
	public List<Residence> residenceList(Integer pageSize, Integer start,String projectName,List<String> rids) {
		return residenceDao.residenceList(pageSize,start,projectName,rids);
	}

	@Override
	public Integer residenceSize(Integer pageSize, Integer start,String projectName,List<String> rids) {
		return residenceDao.residenceSize(pageSize,start,projectName,rids);
	}

	@Override
	public void insertResidence(Residence residence) {
		residence.setCreateTime(new Date());
		residence.setModifyTime(new Date());
		residenceDao.insert(residence);
	}

	@Override
	public void updateResidence(Residence residence) {
		residence.setModifyTime(new Date());
		residenceDao.updateByPrimaryKey(residence);
	}

	@Override
	public void deleteResidences(Integer hid) {
		residenceDao.deleteByPrimaryKey(hid);
	}

	@Override
	public void deleteResidences(List<String> hid) {
		residenceDao.deleteResidences(hid);
	}

	@Override
	public List<Residence> getAllResidence() {
		return residenceDao.getAllResidence();
	}
	@Override
	public List<Residence> getResidence(List<String> rids) {
		return residenceDao.getResidence(rids);
	}

	@Override
	public Residence getResidenceById(Integer id) {
		return residenceDao.selectByPrimaryKey(id);
	}

	@Override
	public Residence getResidenceByHouseId(Integer houseId) {
		return residenceDao.getResidenceByHouseId(houseId);
	}

	@Override
	public List<Residence> getResidenceByUserId(Integer uid) {
		return residenceDao.getResidenceByUserId(uid);
	}

	@Override
	public List<Residence> getResidenceByName(String name) {
		return residenceDao.getResidenceByName(name);
	}

	@Override
	public void insertBatch(List<Residence> list) {
		residenceDao.insertBatch(list);
	}

	@Override
	public List<Residence> selectByName(List<Residence> list) {
		return residenceDao.selectByName(list);
	}
}
